﻿using System;

namespace ToeplitzMatrix {
    class Program {
        static int Maxsize = 10;
        static bool isToeplitzMatrix(int[][] matrix, int col, int row) {
            for (int i = 1; i < col && i < row; i++) {
                if (matrix[i][i] != matrix[0][0]) {
                    return false;
                }
            }
            return true;
        }
        static void Main(string[] args) {
            int rowNumber = 0;
            int colNumber = 0;
            int[][] matrix;
            do {
                Console.WriteLine("Input(Row Number)(Positive Integer):");
                try {
                    rowNumber = int.Parse(Console.ReadLine());
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }
            } while (rowNumber <= 0);
            do {
                Console.WriteLine("Input(Col Number)(Positive Integer):");
                try {
                    colNumber = int.Parse(Console.ReadLine());
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }
            } while (colNumber <= 0);
            matrix = new int[rowNumber][];
            for (int i = 0; i < rowNumber; i++) {
                matrix[i] = new int[colNumber];
                for (int j = 0; j < colNumber; j++) {
                    do {
                        Console.WriteLine($"Input(Row {i + 1}, Col {j + 1})(Integer):");
                        try {
                            matrix[i][j] = int.Parse(Console.ReadLine());
                        }
                        catch (Exception e) {
                            Console.WriteLine(e);
                        }
                    } while (matrix[i][j] <= 0);
                }
            }
            Console.WriteLine("Is Toeplitz Matrix?");
            Console.WriteLine(isToeplitzMatrix(matrix, colNumber, rowNumber));
        }
    }
}
